<?php
include 'portlet_header.php';
if (getParameter("operation")!=null) $operation=getParameter("operation");
if (getParameter("pageId")!=null) $pageId=getParameter("pageId");
if (getParameter("portalId")!=null) $portalId=getParameter("portalId");
if (getParameter("objectId")!=null) $objectId=getParameter("objectId");
/*
 *
 *
*/

    $sSql="SELECT
portal_credentials.acces,
portal_groups.`name`
FROM
portal_credentials
INNER JOIN portal_groups ON portal_credentials.groupId = portal_groups.id
WHERE
portal_credentials.objectId = $objectId AND
    portal_credentials.portalId = $portalId";


    Portal_log($sSql);
    //echo $sSql;
    $rs=$GLOBALS["conn"]->Execute($sSql);

	if ($rs->RecordCount()>0) {
        ?>

    <table width="80%" border="1">
        <thead>
        <tr>
            <td>Group</td><td>Acces</td>
        </tr>
        </thead>
        <?php
        while ( !$rs->EOF)  {


            ?>
<tr><td><?php echo $rs->fields["name"]; ?></td><td><?php echo $rs->fields["acces"]; ?></td></tr>


            <?php

            $rs->MoveNext();
        }
        ?>
    </table>
<br/>   
    <?php
    }

$sSql="SELECT
*
FROM
portal_groups
WHERE
portal_groups.portalId = $portalId";


Portal_log($sSql);
//echo $sSql;
$rs=$GLOBALS["conn"]->Execute($sSql);

if ($rs->RecordCount()>0) {
    ?>

<select>
    <?php
    while ( !$rs->EOF)  {


        ?>
        <option value="<?php echo $rs->fields["id"]; ?>"><?php echo $rs->fields["name"]; ?></option>


        <?php

        $rs->MoveNext();
    }
    ?>
</select>

<?php
}

include 'portlet_footer.php';
?>